
import * as actionTypes from '../action-types';
const initialState = {number:0}
function reducer(state=initialState, action) {
	console.log(action);//{payload:{type:'ADD',amount:.6},type:'ADD'}
	switch (action.type) {
		case actionTypes.ADD:
			if(action.payload){
				if(action.payload.error){
					return {number:state.number-action.payload.amount};
				}else{
					return {number:state.number+action.payload.amount};
				}
			}else{
				return {number:state.number+1};
			}
		case actionTypes.MINUS:
			return { number: state.number - 1 };
		default:
			return state;
	}
}
export default reducer;